package com.service.impl;

import com.domain.User;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.UserMapper;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public PageInfo<User> selectUserAll(int pageNumber, int pageSize) {
        PageHelper.startPage(pageNumber, pageSize);
        List<User> userList = userMapper.selectUserAll();
        PageInfo<User> pageInfo = new PageInfo<User>(userList);
        return pageInfo;


    }

    @Override
    public void insert(User user) {
        userMapper.insert(user);
    }
}
